"""
# 装饰器实现方式
class Person(object):

    def __init__(self):
        self.__age = 0

    @property
    def age(self):
        return self.__age

    @age.setter
    def age(self, new_age):
        self.__age = new_age


p = Person()
p.age = 100
print(p.age)
"""


# 类属性实现方式
class Person(object):

    def __init__(self):
        self.__age = 0

    def get_age(self):
        return self.__age

    def set_age(self, new_age):
        self.__age = new_age

    age = property(get_age, set_age)


p1 = Person()
p1.age = 100
print(p1.age)

p2 = Person()
p2.age = 200
print(p2.age)

